package com.kinggrid.mybatisplus.pagination.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.kinggrid.mybatisplus.pagination.dto.UserDTO;
import com.kinggrid.mybatisplus.pagination.mapper.UserMapper;
import com.kinggrid.mybatisplus.pagination.pagination.Pagination;
import com.kinggrid.mybatisplus.pagination.testcase.MapperTestCase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    private UserMapper userMapper;
    @Autowired
    MapperTestCase mapperTestCase;


    // 测试访问 http://localhost:8080/info
    @GetMapping("/info")
    public UserDTO info(@RequestParam("id") int id) {
        return mapperTestCase.testfinbyId1(id);
    }

    // 测试访问 http://localhost:8080/info
    @GetMapping("/list")
    public Pagination info() {
        return mapperTestCase.list1();
    }

}
